/*基于GPLv2发布
2007/12/16
作者：旅行者2号
laf163@gmail.com*/

#ifndef CAPTURETHREAD_H
#define CAPTURETHREAD_H
#include <QtCore>
#include <QtGui>
#include <pcap.h>
#include <string.h>

/* default snap length (maximum bytes per packet to capture) */
#define SNAP_LEN 1518

/* ethernet headers are always exactly 14 bytes [1] */
#define SIZE_ETHERNET 14

/* Ethernet addresses are 6 bytes */
#define ETHER_ADDR_LEN  6

/* Ethernet header */
struct struct_ethernet
{
  u_char ether_dhost[ETHER_ADDR_LEN];	/* destination host address */
  u_char ether_shost[ETHER_ADDR_LEN];	/* source host address */
  u_short ether_type;		/* IP? ARP? RARP? etc */
};

			/* ARP header */
struct struct_arp
{
  u_short ar_hrd;		/* format of hardware address */
  u_short ar_pro;		/* format of protocol address */
  u_char ar_hln;		/* length of hardware address  */
  u_char ar_pln;		/* length of protocol address  */
  u_short op;			/* ARP opcode */
  u_char sha[6];		/* sender hardware address  */
  u_char sip[4];		/* sender IP address       */
  u_char tha[6];		/* target hardware address  */
  u_char tip[4];		/* target IP address       */
};

#ifndef WIN32
char *strlwr (char *str);
#endif

struct struct_arplist{
	char op;//arp opcode
	char sha[18];//sender hardware address
	char tha[18];//target hardware address
	char sip[16];//sender IP address
	char tip[16];//target IP address
	long count;
};

class CaptureThread:public QThread
{
	Q_OBJECT
public:
	CaptureThread();
	~CaptureThread();
protected:
  void run ();
private:

};
#endif
